import * as types from '../mutation-types';
import { typeOf } from 'common/js/utils';
// utils
import { findDeeply } from 'common/js/utils';

export const setTicket = ({ commit, getters }, ticket = '') => {
  const oldTicket = getters.ticket;
  if (oldTicket === ticket) return;
  if (typeOf(ticket) !== 'string') throw new Error('ticket类型不对');
  commit(types.SET_TICKET, ticket);
};
export const setUserInfo = ({ commit }, userInfo = {}) => {
  if (typeOf(userInfo) !== 'object') throw new Error('userInfo类型不对');
  commit(types.SET_USERINFO, userInfo);
};
